<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <div>
        <p>11</p>
    </div>

    <script>

        // replaceChild()   替换

        var oDiv = document.querySelector('div');

        var oP = document.querySelector('p');

        var oH1 = document.createElement('h1');
        oH1.innerHTML = '666';

        oDiv.replaceChild(oH1, oP);

    </script>

</body>

</html>